<template>
  <div id="app">
    <h2>测试题</h2>
    <SubjectItem @submit="item.isComplete = $event" :item="item" v-for="(item) in sum" :key="item.id"></SubjectItem>
    <div>
      <FlagItem :item="item" v-for="item in sum" :key="item.id"></FlagItem>
    </div>
  </div>
</template>

<script>
import FlagItem from './components/FlagItem.vue';
import SubjectItem from './components/SubjectItem.vue';


export default {
  components: {
    SubjectItem,
    FlagItem
  },
  data() { 
    return {
      sum: [
        {
        id:1,
        num1:Math.floor(Math.random()*10),
        num2: Math.floor(Math.random() * 10),
        isComplete: 0
        },
        {
        id:2,
        num1:Math.floor(Math.random()*10),
        num2: Math.floor(Math.random() * 10),
        isComplete: 0
        },
        {
          id:3,
        num1:Math.floor(Math.random()*10),
          num2: Math.floor(Math.random() * 10),
        isComplete: 0
        },
        {
          id:4,
        num1:Math.floor(Math.random()*10),
          num2: Math.floor(Math.random() * 10),
        isComplete: 0
        
        },
        {
          id:5,
        num1:Math.floor(Math.random()*10),
          num2: Math.floor(Math.random() * 10),
        isComplete: 0
      },
      ]
    }
  },
  methods: {
  }
};
</script>

<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>